#ifndef SCOPE_HELPER_H
#define SCOPE_HELPER_H

#include "scope_snap.h"

#ifdef __cplusplus
extern "C" {
#endif

#define _INDEX_TO_PIO(index)    pio##index
#define INDEX_TO_PIO(index)    _INDEX_TO_PIO(index)

#define _INDEX_TO_RX_REQ(pio_index, sm_index)    DREQ_PIO##pio_index##_RX##sm_index
#define INDEX_TO_RX_REQ(pio_index, sm_index)     _INDEX_TO_RX_REQ(pio_index, sm_index)

#define _INDEX_TO_TX_REQ(pio_index, sm_index)    DREQ_PIO##pio_index##_TX##sm_index
#define INDEX_TO_TX_REQ(pio_index, sm_index)     _INDEX_TO_TX_REQ(pio_index, sm_index)

int scope_helper_value_to_index_round_up(int rate);
int scope_helper_value_to_index_round_down(int rate);
int scope_helper_index_to_value(int index);
int scope_helper_get_step(void);
void scope_helper_buffer_cali_data(scope_snap_info *info);
void scope_helper_correct_time_div(void);
int scope_helper_buffer_get_rate_by_div(uint32_t time_div_us);

#ifdef __cplusplus
}
#endif

#endif
